package com.xxx.exception;


import com.xxx.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 统一异常处理
 */
@Slf4j
@RestControllerAdvice
public class AuthorizationExceptionHandler {

    @ExceptionHandler
    @ResponseBody
    public Result authorizationException(AuthorizationException e){
        log.debug("AuthorizationException:{}",e.getMessage());
        return new Result(null, 401,"暂时没有权限访问");
    }

}
